import unittest

from com.test.HTMLTestRunnerX import HTMLTestRunner
from com.test.demo2 import Demo2
from com.test.单元测试unitTest import MyTestCase

if __name__ == "__main__" :
    testsuit = unittest.TestSuite()
    testcase1 = unittest.TestLoader().loadTestsFromTestCase(Demo2)
    testcase2 = unittest.TestLoader().loadTestsFromTestCase(MyTestCase)
    testsuit.addTest(testcase1)
    testsuit.addTest(testcase2)
    # 定义报告文件
    # report = open("a.txt",mode="w",encoding="utf-8")
    # runner = unittest.TextTestRunner(stream=report,verbosity=2)
    # runner.run(testsuit)
    # 定义报告文件
    report = open("测试报告.html",mode="wb")
    runner = HTMLTestRunner(stream=report,verbosity=3,title="pytest测试用例demo")
    runner.run(testsuit)